home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / PCXKIT.ARJ / SHOWVGA.PAS < prev   
Pascal/Delphi Source File  |  1992-01-06  |  2KB  |  66 lines

  1.  
  2. program SHOWVGA;
  3.  
  4. (* Sample implementation of PCX.TPU for VGA 16-color files. You need to
  5.    have the Turbo .BGI files in the current directory, or change the
  6.    Initgraph path. Enter a filename (without extension) on the command line
  7.    or, if running under Turbo, in the Parameters box. *)
  8.  
  9. uses
  10.   GRAPH,
  11.   DOS,
  12.   CRT,
  13.   PCX;
  14.  
  15. var
  16.   slot,
  17.   grdriver,
  18.   grmode : integer;
  19.  
  20.   (* --------------------------------------------------------------------- *)
  21.  
  22.   procedure VIDEO_DISABLE(off : boolean);
  23.  
  24. (* Because an extra display page is not always available in VGA modes,
  25.    we can't use SetVisualPage to hide the image while it is being written
  26.    to the screen and the colors are being altered. Instead we can get BIOS
  27.    to turn off the screen. This method has the added advantage of speeding
  28.    up the writing of the image to display memory. Note that the function is
  29.    not available on EGA cards. *)
  30.  
  31.   var
  32.     regs : registers;
  33.  
  34.   begin
  35.     regs.ah := $12;                    { BIOS function }
  36.     regs.al := ord(off);               { 0 = on, 1 = off }
  37.     regs.bl := $36;                    { Subfunction }
  38.     intr($10, regs);                   { Call BIOS }
  39.   end;
  40.  
  41.   (* --------------------------------------------------------------------- *)
  42.  
  43. BEGIN                                  { SHOWVGA }
  44.   pcxfilename := paramstr(1) + '.PCX';
  45.   grdriver := vga;
  46.   grmode := vgahi;    { 640x480x16 format }
  47.   initgraph(grdriver, grmode, '');
  48.   VIDEO_DISABLE(true);
  49.   read_pcx_file(grdriver, pcxfilename);
  50.   if file_error then
  51.     begin
  52.       closegraph;
  53.       writeln('File ', fexpand(pcxfilename), ' not found.');
  54.       halt
  55.     end;
  56.   for slot := 0 to 15 do               { Alter the registers }
  57.     with RGBpal[slot] do
  58.       setRGBpalette(slot, redval, greenval, blueval);
  59.   setallpalette(pal);                  { Point to registers 0-15 }
  60.   VIDEO_DISABLE(false);                { Turn on video }
  61.   repeat
  62.   until (readkey <> #1);
  63.   closegraph
  64. END.
  65.  
  66.